package com.lxy.dataservice.controller;

import com.coxautodev.graphql.tools.GraphQLMutationResolver;
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import com.lxy.dataservice.entity.Staff;
import com.lxy.dataservice.service.StaffService;
import com.nip.db.mongodb.utils.tips.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * MemberController
 *
 * @author < a href=" ">BBB</ a>
 * @version v1.0.01
 * @date 2019-12-26 14:44
 */
@Component
public class StaffController implements GraphQLQueryResolver, GraphQLMutationResolver {
  @Autowired
  StaffService staffService;

  public List<Staff> findAllStaff() {
    return staffService.findAllStaff();
  }

  public Staff findStaffById(String id) {
    return staffService.findStaffById(id);
  }

  public Response saveStaff(Staff entity) {
    return staffService.saveStaff(entity);
  }

  public Response deleteStaffById(String id) {
    return staffService.deleteStaffById(id);
  }

  public Response loginStaff(String cardNumber, String password){
    return staffService.login(cardNumber, password);
  }

  public List<Staff> findStaffByCardNumber(String cardNumber){
    return staffService.findAllByCardNumberLike(cardNumber);
  }

  }
